/**
    Copyright (c) 2010-2011 yakiimo02
    Distributed under the New BSD License.
    See included license.txt or http://www.yakiimo3d.com/NewBSDLicense.txt
**/

#pragma once

#include "DataBuffer.h"

/**    
    @brief  Data buffer with DX11 interfaces.
    @date   2010/01/30
*/
class DataBufferDX11 : public DataBuffer
{
public:
    DataBufferDX11();
    ~DataBufferDX11();

    HRESULT OnResizedSwapChain( ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc );
    void    Destroy();
    void    UpdateBuffer( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext );

    inline ID3D11ShaderResourceView*    GetpSRVGPU() { return m_pSRVGPU; }
    inline ID3D11ShaderResourceView*    GetpSRVCPU() { return m_pSRVCPU; }
    inline ID3D11ShaderResourceView*    GetpSRVCUDA() { return m_pSRVCUDA; }
    inline ID3D11Buffer*                GetpBufferGPU() { return m_pBufferGPU; }
    inline ID3D11Buffer*                GetpBufferCPU() { return m_pBufferCPU; }
    inline ID3D11Buffer*                GetpBufferCUDA() { return m_pBufferCUDA; }

protected:
    HRESULT Create( ID3D11Device* pd3dDevice, int nWidth, int nHeight );

protected:
    ID3D11Buffer*                m_pBufferGPU;        // structured buffer for the gpu
    ID3D11Buffer*                m_pBufferCPU;        // structured buffer for the cpu
    ID3D11Buffer*                m_pBufferCUDA;       // structured buffer for the cuda
    ID3D11ShaderResourceView*    m_pSRVCPU;           // shader resource view for cpu structured buffer
    ID3D11ShaderResourceView*    m_pSRVGPU;           // shader resource view for gpu structured buffer
    ID3D11ShaderResourceView*    m_pSRVCUDA;          // shader resource view for cuda structured buffer
};

